<template>
  <div>
    <p>子组件</p>
    <!-- <p v-for="item in par" :key="item">{{ item }}</p>
    <button @click="btnTap">点击</button> -->
    <input type="text" v-model="num" />
    <button @click="childrenTap">传值</button>
  </div>
</template>

<script>
import bus from "@/config/eventBus.js";
export default {
  name: "children",
  // props: ["par"],
  data() {
    return {
      num: 1
    };
  },
  methods: {
    // childrenTap() {
    //   this.$emit("push-msg", this.msg);
    // }
    childrenTap() {
      bus.$emit("pushMsg", this.num);
    }
  },
  mounted() {
    var that = this;
    bus.$on("pushPMsg", function(num) {
      window.console.log(num);
      that.num += num;
    });
  }
};
</script>

<style scoped></style>8
